<form id="auto-data-form" action="user/saveOrUpdate" class="form-horizontal bv-form" method="post" role="form">
	<div style="display: none;">
		<input id="model.id" name="model.id" value="#(model.id)" placeholder="用户主键" type="hidden" />
		<input id="updatePwd" name="updatePwd" value="false" type="hidden" />
	</div>
<div class="row">
	<div class="col-sm-9">	
	<div class="form-group">
		<label for="model.code" class="col-sm-2 control-label">登录账号</label>
		<div class="col-sm-4">
			<input id="model.code" name="model.code" value="#(model.code)" #if(model.id)readonly="readonly" #end placeholder="登录账号" class="form-control input-md" required maxlength="64"/>
		</div>
		<label for="model.pwd" class="col-sm-2 control-label">登录密码</label>
		<div class="col-sm-4">
			#if(!model.id)
			<input id="model.pwd" name="model.pwd" value="#(model.pwd)" placeholder="登录密码" class="form-control input-md" required maxlength="16" type="password"/>
			#end
			#if(model.id)
			<div class="input-group">
			<input id="model.pwd" name="model.pwd" value="" placeholder="登录密码" class="form-control input-md" readonly maxlength="16" type="password"/>
			<span class="input-group-addon" title="修改密码" onclick="_updatePwd();" style="cursor:pointer;"><i class="fa fa-edit"></i></span>
			</div>
			#end			
		</div>
	</div>
	<div class="form-group">
		<label for="model.name" class="col-sm-2 control-label">用户名称</label>
		<div class="col-sm-4">
			<input id="model.name" name="model.name" value="#(model.name)" placeholder="用户名称" class="form-control input-md" required maxlength="64"/>
		</div>
		<label for="model.orgId" class="col-sm-2 control-label">所属机构</label>
		<div class="col-sm-4">
			<input id="model.orgId" name="model.orgId" value="#(model.orgId)" placeholder="机构主键" class="form-control input-md auto-tree-select" required type="number"
			data-uri="org/children?state=01" data-text="#(model.org.name??)"/>
		</div>
	</div>

	<div class="form-group">
		<label for="model.tel" class="col-sm-2 control-label">电话号码</label>
		<div class="col-sm-4">
			<input id="model.tel" name="model.tel" value="#(model.tel)" placeholder="电话号码" class="form-control input-md" maxlength="32"/>
		</div>
		<label for="model.mobile" class="col-sm-2 control-label">手机号码</label>
		<div class="col-sm-4">
			<input id="model.mobile" name="model.mobile" value="#(model.mobile)" placeholder="手机号码" class="form-control input-md" maxlength="32"/>
		</div>
	</div>
	
	<div class="form-group">
		<label for="model.email" class="col-sm-2 control-label">电子邮件</label>
		<div class="col-sm-4">
			<input id="model.email" name="model.email" value="#(model.email)" placeholder="电子邮件" class="form-control input-md" maxlength="32" type="email"/>
		</div>
		<label for="model.card" class="col-sm-2 control-label">身份证</label>
		<div class="col-sm-4">
			<input id="model.card" name="model.card" value="#(model.card)" placeholder="身份证" class="form-control input-md" maxlength="32"/>
		</div>
	</div>
	
	<div class="form-group">
		<label for="model.state" class="col-sm-2 control-label">用户状态</label>
		<div class="col-sm-4">
			#@dict_select("model.state",model.state,"USER_STATE",false,"用户状态","required")
		</div>
		<label for="model.sort" class="col-sm-2 control-label">排序号</label>
		<div class="col-sm-4">
			<input id="model.sort" name="model.sort" value="#(model.sort)" placeholder="排序号" class="form-control input-md" required data-bv-integer maxlength="10" type="number"/>
		</div>
	</div>
	
	<div class="form-group">
		<label for="model.remark" class="col-sm-2 control-label">用户描述</label>
		<div class="col-sm-10">
			<textarea id="model.remark" name="model.remark" placeholder="描述" class="form-control input-md" maxlength="1024">#(model.remark)</textarea>
		</div>
	</div>
	</div>
	<div class="col-sm-3">	
		<div class="panel panel-default">
		    <div class="panel-heading">
		        <h3 class="panel-title">用户角色</h3>
		    </div>
		    <div class="panel-body">
		    	#for(x:roles)
		        <div class="checkbox checkbox-success">
                    <input id="userRole_#(x.id)" name="userRoles" value="#(x.id)" #if(x.user_id)checked #end class="styled" type="checkbox">
                    <label for="userRole_#(x.id)">#(x.name) </label>
                </div>
                #end
		    </div>
		</div>
	</div>
 </div>	
</form>
<script type="text/javascript">
	function _updatePwd(){
		var pwd=jid("model.pwd").prop("readonly",false).attr("required","true");
		$("#updatePwd").val("true");
		$("#auto-data-form").bootstrapValidator("addField",pwd);
	}
	$(document).ready(function() {
	});
</script>